package com.sh.设计模式.工厂模式相关.抽象工厂模式;

import com.sh.设计模式.工厂模式相关.抽象工厂模式.工厂impl.AudiFactory;
import com.sh.设计模式.工厂模式相关.抽象工厂模式.工厂impl.BMWFactory;

public class AbstractFactoryTest {
    public static void main(String[] args) {
        CarFactory bmwFactory = new BMWFactory();
        Car bmwCar = bmwFactory.createCar();
        Engine bmwEngine = bmwFactory.createEngine();
        bmwCar.drive();       // Driving BMW Car
        bmwEngine.run();      // BMW Engine Running

        CarFactory audiFactory = new AudiFactory();
        Car audiCar = audiFactory.createCar();
        Engine audiEngine = audiFactory.createEngine();
        audiCar.drive();      // Driving Audi Car
        audiEngine.run();     // Audi Engine Running
    }
}